#ifndef WINSCARD_H
#define WINSCARD_H

#define far
#define near

typedef long LONG;
typedef unsigned long ULONG;
typedef ULONG SCARDCONTEXT;
typedef SCARDCONTEXT *PSCARDCONTEXT, *LPSCARDCONTEXT;
typedef const char *LPCSTR;
typedef char *LPSTR;
typedef unsigned long       DWORD;
typedef ULONG SCARDHANDLE;
typedef SCARDHANDLE *PSCARDHANDLE, *LPSCARDHANDLE;
typedef DWORD far           *LPDWORD;

typedef const void *LPCVOID;
typedef unsigned char       BYTE;
typedef const BYTE *LPCBYTE;
typedef BYTE far            *LPBYTE;

typedef unsigned short WCHAR;
typedef WCHAR *LPWSTR;
typedef LPWSTR LPTSTR;

typedef struct _SCARD_IO_REQUEST{
    DWORD dwProtocol;   // Protocol identifier
    DWORD cbPciLength;  // Protocol Control Information Length
} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;

typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;

//const SCARD_IO_REQUEST
//    g_rgSCardT0Pci,
//    g_rgSCardT1Pci,
//    g_rgSCardRawPci;
//#define SCARD_PCI_T0  (&g_rgSCardT0Pci)
//#define SCARD_PCI_T1  (&g_rgSCardT1Pci)
//#define SCARD_PCI_RAW (&g_rgSCardRawPci)


#define SCARD_PROTOCOL_UNDEFINED    0x00000000  // There is no active protocol.
#define SCARD_PROTOCOL_T0           0x00000001  // T=0 is the active protocol.
#define SCARD_PROTOCOL_T1           0x00000002  // T=1 is the active protocol.
#define SCARD_PROTOCOL_RAW          0x00010000  // Raw is the active protocol.
#define SCARD_PROTOCOL_DEFAULT      0x80000000  // Use implicit PTS.

#define SCARD_SHARE_EXCLUSIVE 1 // This application is not willing to share this
                                // card with other applications.
#define SCARD_SHARE_SHARED    2 // This application is willing to share this
                                // card with other applications.
#define SCARD_SHARE_DIRECT    3 // This application demands direct control of
                                // the reader, so it is not available to other
                                // applications.

#define SCARD_AUTOALLOCATE (DWORD)(-1)

#define SCARD_SCOPE_USER     0  // The context is a user context, and any
                                // database operations are performed within the
                                // domain of the user.
#define SCARD_SCOPE_TERMINAL 1  // The context is that of the current terminal,
                                // and any database operations are performed
                                // within the domain of that terminal.  (The
                                // calling application must have appropriate
                                // access permissions for any database actions.)
#define SCARD_SCOPE_SYSTEM    2 // The context is the system context, and any
                                // database operations are performed within the
                                // domain of the system.  (The calling
                                // application must have appropriate access
                                // permissions for any database actions.)

#define SCARD_LEAVE_CARD      0 // Don't do anything special on close
#define SCARD_RESET_CARD      1 // Reset the card on close
#define SCARD_UNPOWER_CARD    2 // Power down the card on close
#define SCARD_EJECT_CARD      3 // Eject the card on close





#endif // WINSCARD_H
